// https://leetcode.cn/problems/invert-binary-tree/submissions/498182459/

import TreeNode from "./TreeNode";


function invertTree(root: TreeNode | null): TreeNode | null {

    if(!root) return null;
    // 存储左子节点
    let left = root.left;
    // 将右几点复制给左节点
    root.left = invertTree(root.right);
    // 将之前存储的左子节点赋值给右节点
    root.right = invertTree(left);
    
    return root;
};

export {}